﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using Digitalmes.Model;
using Digitalmes.Model.IoTManagement;

namespace Digitalmes.Model.IoTManagement
{
    /// <summary>
    /// 采集任务表
    /// </summary>
	[Table("CollectTask")]

    [Display(Name = "_Model.CollectTask")]
    public class CollectTask : BasePoco,IPersistPoco,ITenant
    {
        [Key]
        [Display(Name = "_Model._CollectTask._ID")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public new long ID { get; set; }
        [Display(Name = "_Model._CollectTask._TaskName")]
        [Comment("任务名称")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string TaskName { get; set; }
        [Display(Name = "_Model._CollectTask._TargetDeviceType")]
        [Comment("设备类型")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public MeterDeviceTypeEnum? TargetDeviceType { get; set; }
        [Display(Name = "_Model._CollectTask._Device")]
        [Comment("设备")]
        public MeterDevice Device { get; set; }
        [Display(Name = "_Model._CollectTask._Device")]
        [Comment("设备")]
        public long? DeviceId { get; set; }
        [Display(Name = "_Model._CollectTask._IntervalMinutes")]
        [Comment("采集频率(分钟)")]
        [Range(1,999999999,ErrorMessage="Validate.{0}range{1}")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public int? IntervalMinutes { get; set; }
        [Display(Name = "_Model._CollectTask._StartTime")]
        [Comment("开始时间")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public DateTime? StartTime { get; set; }
        [Display(Name = "_Model._CollectTask._EndTime")]
        [Comment("结束时间")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public DateTime? EndTime { get; set; }
        [Display(Name = "_Model._CollectTask._Status")]
        [Comment("任务状态")]
        public TaskStatusEnum? Status { get; set; }
        [Display(Name = "_Model._CollectTask._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

	}

}
